package com.tx.txlibs;

public enum CardType {
    CLIENT_CARD(0, "授权卡"),
    GUEST_CARD(1, "宾客卡"),
    FLOOR_CARD(2,"楼层卡"),
    BUILDING_CARD(3,"楼栋卡"),
    CHIEF_CARD(5,"总卡"),
    INSTALL_CARD(6,"安装卡"),
    LOST_CARD(7,"挂失卡"),
    UN_LOST_CARD(8,"取消挂失卡"),
    TIME_CARD(9,"校时卡"),
    DATA_CARD(10,"数据卡"),
    CHECKOUT_CARD(14,"退房卡"),
    MANAGE_CARD(16,"清除卡"),
    STAFF_CARD(17,"多门卡"),
    LOCK_SETTING_CARD(18,"锁体设置卡"),
    ELEVATOR_CARD(20,"电梯卡"),
    JOIN_NET_CARD(21,"入网卡"),
    EXIT_NET_CARD(22,"退网卡"),
    PARA_SETTING_CARD(23,"参数设置卡");

    private int index;
    private String name;

    private CardType(int index, String name) {
        this.name = name;
        this.index = index;
    }

    public static String getName(int index) {
        for (CardType c : CardType.values()) {
            if (c.index == index) {
                return c.name;
            }
        }
        return null;
    }

    public static int getIndex(String name) {
        for (CardType c : CardType.values()) {
            if (c.name.equals(name)) {
                return c.index;
            }
        }
        return 0;
    }

    @Override
    public String toString() {
        return this.index + "_" + this.name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }
}
